package com.molin.threadTest.threadPoolTest;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class Demo2 {
    public static void main(String[] args) {
        ThreadPoolExecutor threadPoolExecutor=new ThreadPoolExecutor(2,5,2, TimeUnit.SECONDS,new ArrayBlockingQueue<>(10), Executors.defaultThreadFactory(),new ThreadPoolExecutor.AbortPolicy());
        threadPoolExecutor.submit(()->{
            System.out.println(Thread.currentThread().getName() + " ");
        });

        threadPoolExecutor.submit(()->{
            System.out.println(Thread.currentThread().getName() + " ");
        });

        threadPoolExecutor.shutdown();


    }
}
